Python for fundamental investing script question

by: stoli, 7 years ago



Hello, My goal is to create script that gathers fundamental data from site like morning star or yahoo finances stuff like companies p/a, p/b, various incomes and expenses so I can calculate them with python based on my needs.

I began watching series on youtube https://www.youtube.com/watch?v=K2zyPby4034&index=3&list=PLQVvvaa0QuDejNczz7dbpyu3JnwUBvNch which brought me to this forum. The vid is basicly exactly what Im interested in but the methods does not work anymore. I know that I could convert the python 2 code to python 3 and use yahoo module instead of parser. But then, I am quite beginner on python anyways so I wonder what would be the best way for me to learn and achieve this goal. Use all those hacky ways or maybe there is a better ways with python 3? I readed a bit about pandas and beautiful soup not sure if they are fit for the purpose. Maybe someone could point me to the right direction what to investigte :P

Also one option would be to switch to python 2 but based on what I have read so far I should start with python 3. Let me know what do you think.

Thanks!



You must be logged in to post. Please login or register an account.



Hmm, well, that series is certainly outdated. You cannot parse Yahoo like that anymore, you need to use more advanced parsing, which can process the dynamic javascript filling fields:

https://pythonprogramming.net/javascript-dynamic-scraping-parsing-beautiful-soup-tutorial/

Other than that, the tutorial there is Python 2. There will definitely be some things you will have to change for Python 3, and you should be using Python 3 by now, but you will get syntax errors for most of the errors (things like exception handling and the print statement => function will be the most problematic I expect).

One of the best ways to learn is to adapt something to what you want to use it for, however. You might find that overcoming some of these smaller hurdles is only beneficial to you.... or super annoying :P The biggest issue and difference now is just parsing those tables though, and it's possible with the above method linked I am pretty sure.





-Harrison 7 years ago

You must be logged in to post. Please login or register an account.


Thanks, I rather start from scratch and build from there. I already were thinking about beautiful soup as option. What about pandas can it be used for this kind of purpose?

-stoli 7 years ago

You must be logged in to post. Please login or register an account.